<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <script>
        // Symbol()
        const sym = Symbol('chen');

        console.log(sym.toString());  // Symbol(chen)
        console.log(sym.description);  // chen


        // Symbol.for(),
        console.log(Symbol.for("bar") === Symbol.for("bar"));  // true
        console.log(Symbol("bar") === Symbol("bar"));  // false

        // Symbol.keyFor()
        let s1 = Symbol.for("chen");
        console.log(Symbol.keyFor(s1));  // chen

        let s2 = Symbol("chen");
        console.log(Symbol.keyFor(s2));  // undefined

        console.log("hello");

    </script>

</head>
<body>

</body>
</html>